<script type="text/javascript" src="module/mod_ppk/js/kabupaten.js"></script>

<div id="tiga_ba">
	<div id="tiga_baa">Ubah Data PPK</div>
	<div id="tiga_bab"></div>
	<div class="clear"></div>
</div>
            
<?php
	$id=$_GET['id'];
	$sql="select p.id_ppk,p.nama,p.id_jenis,p.alamat,p.id_kabupaten,p.id_kelas, p.id_kelas_tarif, p.direktur,k.id_propinsi from ppk p inner join kabupaten k on p.id_kabupaten = k.id_kabupaten where p.id_ppk = $id";
	//echo $sql;
	$qry=mysql_query($sql);
	$hasil=mysql_fetch_array($qry);
?>
<form action="utama.php?module=mod_ppk&act=update" onsubmit="return gsValidate('nama|alamat|kabupaten|direktur','Nama PPK Harus Diisi|Alamat PPK Harus Diisi|Nama Kabupaten Harus Dipilih|Diisi','required|required|required|required');" method="post" enctype="multipart/form-data">
	<table style="margin: 10px 15px 10px 15px;">
		<tr>
			<td>Kode PPK</td>
			<td>&nbsp;</td>
			<td>
				<input name="id" type="text" id="id" value="<?php echo $hasil['id_ppk']?>" class="input_small" disabled/>
			</td>
		</tr>
		<tr>
			<td>Nama PPK</td>
			<td>&nbsp;</td>
			<td>
				<input name="nama" type="text" class="input2" id="nama" maxlength="50" value="<?php echo $hasil['nama']?>"/>
				<input name="id_ppk" type="hidden" id="id_ppk" value="<?php echo $hasil['id_ppk']?>" />
				<span class="red">*</span>
			</td>
		</tr>
		<tr>
			<td>Jenis PPK</td>
			<td>&nbsp;</td>
			<td>
				<select name="jenis" class="input2">
					<?php
						$jenis = mysql_query("select * from jenis_ppk");
						while($j=mysql_fetch_array($jenis)){
							if($j['id_jenis'] == $hasil['id_jenis']){
								$s = "selected";
							}else{
								$s = "";
							}
							echo "<option value=$j[id_jenis] $s>$j[jenis]</option>";
						}
					?>
				</select>
			</td>
		</tr>
		<tr>
			<td>Alamat</td>
			<td>&nbsp;</td>
			<td>
				<input name="alamat" type="text" class="input" id="alamat" maxlength="255" value="<?php echo $hasil['alamat']?>"/>
				<span class="red">*</span>
			</td>
		</tr>
		<tr>
			<td>Provinsi</td>
			<td>&nbsp;</td>
			<td>
				<select name="provinsi" id="provinsi" class="input2">
					<?php
						$provinsi = mysql_query("select * from propinsi where aktif = 'Y' order by propinsi");
						while($p = mysql_fetch_array($provinsi)){
							if($p['id_propinsi'] == $hasil['id_propinsi']){
								$s = "selected";
							}else{
								$s = "";
							}
							echo "<option value='$p[id_propinsi]' $s>$p[propinsi]</option>";
						}
					?>
				</select>
			</td>
		</tr>
		<tr>
			<td>Kabupaten</td>
			<td>&nbsp;</td>
			<td>
				<select name="kabupaten" id="kabupaten" class="input2">
					<?php
						$kabupaten = mysql_query("select * from kabupaten where id_propinsi = $hasil[id_propinsi] and aktif = 'Y' order by kabupaten");
						while($k = mysql_fetch_array($kabupaten)){
							if($k['id_kabupaten'] == $hasil['id_kabupaten']){
								$sk = "selected";
							}else{
								$sk = "";
							}
							echo "<option value='$k[id_kabupaten]' $sk>$k[kabupaten]</option>";
						}
					?>
				</select>
				<span class="red">*</span>
			</td>
		</tr>
		<tr>
			<td>Kelas</td>
			<td>&nbsp;</td>
			<td>
				<?php edit_kombo("kelas","kelas","$hasil[id_kelas]","input_small") ?>
			</td>
		</tr>
		<tr>
			<td>Kelas Tarif</td>
			<td>&nbsp;</td>
			<td>
				<?php edit_kombo("kelas_tarif","kelas_tarif","$hasil[id_kelas_tarif]","input2") ?>
			</td>
		</tr>
		<tr>
			<td>Direktur</td>
			<td>&nbsp;</td>
			<td>
				<input name="direktur" type="text" class="input2" id="direktur" maxlength="50" value="<?php echo $hasil['direktur']?>"/>
				<span class="red">*</span>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td><input name="submit" type="submit" class="button" value="Ubah" /></td>
		</tr>
	</table>
</form>		
            
        